package com.rst.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.rst.dao.DepartmentDAO;
import com.rst.model.Department;

@Service
public class DepartmentService {
	
	@Autowired
	private DepartmentDAO departmentDAO;
	
	public void saveDepartment(Department department) {
		departmentDAO.saveDepartment(department);			
	}

	public Department getDepartmentById(Long departmentId) {
		return departmentDAO.getDepartmentById(departmentId);	
	}

	public List<Department> getDepartmentList() {
		return departmentDAO.getDepartmentList();	
	}

	public String deleteDepartment(Long departmentId) {
		Department department  = departmentDAO.getDepartmentById(departmentId);		
		department.setStatus(Department.INACTIVE);
		departmentDAO.saveDepartment(department);	
		return "success";
	}

	
}
